<template>
    <div v-loading="!isShow">
        <div class="zs-card-sm zs-space-bottom zs-layout-flex-row">
            <el-select v-model="biProjectCode" class="zs-select-md zs-space-right-sm" placeholder="项目名称"
                @change="changeProject()">
                <el-option v-for="item in projectList" :key="item.biProjectCode" :label="item.projectName"
                    :value="item.biProjectCode" />
            </el-select>
        </div>
        <el-scrollbar class="db-content-height" v-if="isShow">
            <div class="db-content-cards">
                <BaseInfo :biProjectCode="biProjectCode" :projectCode="projectCode" :permi="tabPermi"></BaseInfo>
                <!-- 出租情况 -->
                <RentalSituation :permi="'p_btn_901_jingyingchanye_xiangqing_chuzu'" :hideList="hideList"
                    :biProjectCode="biProjectCode" :updateDate="updateDate"></RentalSituation>
                <!--新签面积-->
                <NewSignature :permi="'p_btn_901_jingyingchanye_xiangqing_xinqian'" :hideList="hideList"
                    :biProjectCode="biProjectCode" :updateDate="updateDate"></NewSignature>
                <!--欠款分析-->
                <DebtInformation :permi="'p_btn_901_jingyingchanye_xiangqing_qiankuan'" :hideList="hideList"
                    :biProjectCode="biProjectCode" :updateDate="updateDate"></DebtInformation>
                <!--保证金押金-->
                <DepositAndCashPledge :permi="'p_btn_901_jingyingchanye_xiangqing_bzjyj'" :hideList="hideList"
                    :biProjectCode="biProjectCode" :updateDate="updateDate"></DepositAndCashPledge>
                <!-- 资本化改造 -->
                <CapitalizationTransformation :permi="'p_btn_901_jingyingchanye_xiangqing_zbhgz'" :hideList="hideList"
                    :biProjectCode="biProjectCode" :updateDate="updateDate"></CapitalizationTransformation>
                <!-- 能耗分析 -->
                <EnergyCosts :permi="'p_btn_901_jingyingchanye_xiangqing_nyf'" :hideList="hideList"
                    :biProjectCode="biProjectCode" :updateDate="updateDate" />
                <!-- 预算对标 -->
                <BudgetcAhievement :permi="'p_btn_901_jingyingchanye_xiangqing_ysdb'" :hideList="hideList"
                    :biProjectCode="biProjectCode" :updateDate="updateDate"></BudgetcAhievement>
                <!--两算一控-->
                <TwoControl :permi="'p_btn_901_jingyingchanye_xiangqing_twoandone_control'" :hideList="hideList"
                    :biProjectCode="biProjectCode" :updateDate="updateDate"></TwoControl>
                <!-- 费控对标 -->
                <CostControlStandard :permi="'p_btn_901_jingyingchanye_xiangqing_costcontrol_standards'" :hideList="hideList"
                    :biProjectCode="biProjectCode" :projectCode="projectCode" :updateDate="updateDate" />
                <!--整场测算-->
                <NewSigning :permi="'p_btn_901_jingyingchanye_xiangqing_xinqianqingkuang'" :hideList="hideList"
                    :biProjectCode="biProjectCode" :updateDate="updateDate"></NewSigning>
                <!--整场测算 新-->
                <WholeCalculation :permi="'p_btn_901_jingyingchanye_zhenchangcesuan'" :hideList="hideList"
                    :biProjectCode="biProjectCode" :updateDate="updateDate"></WholeCalculation>
                <!-- 工单监控 -->
                <WorkerOrder :permi="'p_btn_901_jingyingchanye_xiangqing_gongdan'" :hideList="hideList"
                    :projectCode="projectCode" :updateDate="updateDate"></WorkerOrder>
                <!-- 两书对标 -->
                <LiangShu :permi="'p_btn_901_jingyingchanye_xiangqing_lsdb'" :hideList="hideList" :biProjectCode="biProjectCode"
                    :updateDate="updateDate"></LiangShu>
            </div>
        </el-scrollbar>
    </div>
</template>
<script setup>

import BaseInfo from '@/views/Manage/Business/components/baseInfo'
import RentalSituation from '@/views/Manage/Business/components/rentalSituation'
import NewSigning from '@/views/Manage/Business/components/newSigning'
import WholeCalculation from '@/views/Manage/Business/components/wholeCalculation';
import NewSignature from '@/views/Manage/Business/components/newSignature'
import WorkerOrder from '@/views/Manage/Business/components/workerOrder'
import DebtInformation from '@/views/Manage/Business/components/debtInformation'
import DepositAndCashPledge from '@/views/Manage/Business/components/depositAndCashPledge'
import CapitalizationTransformation from '@/views/Manage/Business/components/capitalizationTransformation'
import BudgetcAhievement from '@/views/Manage/Business/components/budgetcAhievement'
import LiangShu from '@/views/Manage/Business/components/liangShu'
import TwoControl from '@/views/Manage/Business/components/twoControl'
import EnergyCosts from '@/views/Manage/Business/components/energyCosts'
import CostControlStandard from '@/views/Manage/Business/components/costControlStandard'

import dbPublicApi from '@/api/dbPublic'

import { ref } from 'vue'
import { useRoute } from 'vue-router'
const route = useRoute().query
let biProjectCode = ref(route.biProjectCode)
const projectCode = ref(route.projectCode)
const updateDate = route.updateDate
const tabPermi = route.tabPermi

let isShow = ref(false)
let hideList = ref([])
let projectList = ref([])
const getHide = async () => {
    await dbPublicApi.queryMenuHidePcApi(biProjectCode.value).then((res) => {
        if (res.data.code == 200) {
            hideList.value = res.data.data
        }
    })
}
const getList = () => {
    dbPublicApi.queryProjectPcApi({ dataTime: updateDate, resourceKey: tabPermi }).then((res) => {
        if (res.data.code == 200) {
            projectList.value = res.data.data
        }
    })
}
const changeProject = async () => {
    isShow.value = false
    await getHide()
    const index = projectList.value.findIndex(item => {
        return item.biProjectCode == biProjectCode.value
    })
    projectCode.value = projectList.value[index].projectCode
    isShow.value = true
}
const init = async () => {
    isShow.value = false
    await getHide()
    getList()
    isShow.value = true
}
init()

// echat 柱图数据
// const echatData = ref({
//     "xData": ["4.13", "4.15", "4.16", "4.17", "4.18", "4.19", "4.20", "4.21"],
//     "xLable": ["4月14日", "4月15日", "4月16日", "4月17日", "4月18日", "4月19日", "4月20日", "4月21日"],
//     "yData": [
//         {
//             "name": "当年",
//             "type": "bar",  // 当前内容显示的图形类型
//             "data": [30, 60, 20, 50, 30, 80, 100, 120],
//             "unit": "%", // 当前内容百分比的单独加单位字段。默认没有单位。data中不能出现%
//             "isShow": true, // 当前内容是否显示 true表示在图表中绘制，false代表只在提示框出现
//             "color": '#ED1A2C' // 代表当前图形颜色 默认不需要传，特殊需求的需要。比如环形图
//         },
//         {
//             "name": "当周日均",
//             "type": "bar",
//             "data": [120, 200],
//             "isShow": false
//         },
//         {
//             "name": "同比上周",
//             "type": "bar",
//             "data": [20, 40],
//             "unit": "%",
//             "isShow": false
//         }
//     ]
// })

</script>
  
<style scoped lang="scss"></style>